(function(app){
	app
	.controller("tabCtrl",["$scope","$state","$rootScope","$ionicPopup","$timeout","$ionicViewSwitcher","$ionicScrollDelegate","$ionicLoading","Alert","Userinfo","HttpGet",
	function($scope,$state,$rootScope,$ionicPopup,$timeout,$ionicViewSwitcher,$ionicScrollDelegate,$ionicLoading,Alert,Userinfo,HttpGet){
		
		var userId = Userinfo.get('userId');
//		$scope.test = "<ion-tab title='设置' icon-off='tab2-off' icon-on='tab2-on' href='#/tab/set'><ion-nav-view name='tab-set'></ion-nav-view></ion-tab>";
		//{"titleName":"车间文档","tabMenu":[{"menuId":"1","menuName":"我的文档","menuImage":"resources/images/mobile/mydocument","menuUrl":"tab/mydoc","menuUrlName":"tab-mydoc"},{"menuId":"2","menuName":"设置","menuImage":"resources/images/mobile/set","menuUrl":"tab/set","menuUrlName":"tab-set"}]}
		var tabs = $rootScope.tabMenu;
		var html = "";
		for(var t in tabs){
			html +=  "<style>."+ tabs[t].menuUrlName +"_off {background: url("+SERVER_IP + tabs[t].menuImage + "_off.png) no-repeat center center;background-size: 24px;}."+tabs[t].menuUrlName +"_on {background: url("+SERVER_IP + tabs[t].menuImage + "_on.png) no-repeat center center;background-size: 24px;}</style>";
			html += '<ion-tab  icon-off="'+ tabs[t].menuUrlName +'_off" icon-on="'+ tabs[t].menuUrlName +'_on" href="'+tabs[t].menuUrl+'?menu_index='+ t +'" title="'+tabs[t].menuName+'"><ion-nav-view name="'+tabs[t].menuUrlName+'"></ion-nav-view></ion-tab>';
		}
		$scope.mytabs = html;

		$scope.views = {
					userName:Userinfo.get('userName'),
					loginName:Userinfo.get('loginName'),
					SERVER_IP:SERVER_IP
				};
			}])
})(app)